package com.example.gifframecpp

import android.graphics.Bitmap

class GifHandler {
    private var gifHandler: Long = 0

    companion object {
        init {
            System.loadLibrary("gifframecpp")
        }

    }

    fun load(path: String) {
        gifHandler = loadGif(path)
    }

    fun getWidth(): Int {
        return getWidth(gifHandler)
    }

    fun getHeight(): Int {
        return getHeight(gifHandler)
    }

    /**
     * @return 这个int是下一帧的时间
     */
    fun updateFrame(bitmap: Bitmap): Int {
        return updateFrame(gifHandler, bitmap)
    }

    external fun loadGif(path: String): Long

    external fun getWidth(gifHandler: Long): Int

    external fun getHeight(gifHandler: Long): Int

    external fun updateFrame(gifHandler: Long, bitmap: Bitmap): Int


}